snippet def "Function" !b
def ${1:function}(`!p
if snip.indent:
   snip.rv = 'self' + (", " if len(t[2]) else "")`${2:arg1}):
	${3:pass}
endsnippet

snippet main "Main" !b
if __name__ == '__main__':
	$0
endsnippet

snippet paired "Paired list"
zip(${1:list}[:-1], $1[1:])$0
endsnippet

snippet np "Import numpy" b
import numpy as np$0
endsnippet

snippet plt "Import pyplot" b
import matplotlib.pyplot as plt$0
endsnippet

snippet ds "Docstring" !b
"""
$0
"""
endsnippet

snippet comp "(List) comprehension" !i
${4:item} for ${1:item} in ${2:items}${3/.+/ if /}${3:condition}${3/.+//}$0
endsnippet

snippet p "Print" b
print($0)
endsnippet

###########################################################################
#                            Argparse snippets                            #
###########################################################################

snippet argparse "Argparse" !b
parser = argparse.ArgumentParser(description='''
${1}
''', formatter_class=argparse.RawDescriptionHelpFormatter)
$0
args = parser.parse_args()
endsnippet

snippet arg "Add argument" !b
parser.add_argument('${1:name}', help='${2:help}')$0
endsnippet

snippet argb "Add argument (boolean flag)" !b
parser.add_argument('${1:name}', action='store_true', help='${2:help}')$0
endsnippet

snippet argf "Add argument (file)" !b
parser.add_argument('${1:name}', type=argparse.FileType('${2:r}'), help='${3:help}')$0
endsnippet
